<a {$f.name}-pointer-show href="#">{$vo[$f['name']]}</a>
<input type="hidden" name="{$f.name}" value="{$vo[$f['name']]}" />
<a class="btn btn-sm btn-primary" {$f.name}-pointer data-name="{$f.name}" href="index.php?c={$f.pointer|parse_name=1}&a=pointer&id={$vo[$f['name']]}">选择</a>

<script type="text/javascript">
$(function(){
    $('[{$f.name}-pointer]').on('click',function(event){
        event.preventDefault();
        var field = $(this).data('name');
        var box = $('<div style="max-height:500px;overflow-y: auto;" class="row"></div>');
        var size = $(this).attr('dialog-size');
        if (!size) size = 'size-wide';
        var url = $(this).attr('href');
        var title = $(this).attr('dialog-title');
        box.load(url);
        BootstrapDialog.show({
            message: box,
            size:size,
            title:title,
            buttons: [{
                label: '确定',
                action: function(dialogRef) {
                    var body = dialogRef.getModalBody();
                    var ck = body.find('[name=id]:checked');
                    if (ck.length > 0) {
                        var id = ck.val();
                        $('[{$f.name}-pointer-show]').text(id);
                        $('[name={$f.name}]').val(id);
                        
                        var u = $('[{$f.name}-pointer]').attr('href');
                        u = U('id',id,u);
                        $('[{$f.name}-pointer]').attr('href',u);
                        dialogRef.close();
                    }

                    
                }
            },{
                label: '取消',
                action: function(dialogRef){
                    dialogRef.close();
                }
            }]
        });
    })
})    
</script>
